﻿using System.Web;
using System.Web.Optimization;
using System.IO;

namespace Circle.Web
{
    public class BundleConfig
    {
        // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
        public static void RegisterBundles(BundleCollection bundles)
        {
            #region Default

            //bundles.AddJson(new ScriptBundle("~/bundles/jquery").Include(
            //            "~/Scripts/jquery-{version}.js"));

            //bundles.AddJson(new ScriptBundle("~/bundles/jqueryui").Include(
            //            "~/Scripts/jquery-ui-{version}.js"));

            //bundles.AddJson(new ScriptBundle("~/bundles/jqueryval").Include(
            //            "~/Scripts/jquery.unobtrusive*",
            //            "~/Scripts/jquery.validate*"));

            //// Use the development version of Modernizr to develop with and learn from. Then, when you're
            //// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            //bundles.AddJson(new ScriptBundle("~/bundles/modernizr").Include(
            //            "~/Scripts/modernizr-*"));

            //bundles.AddJson(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

            //bundles.AddJson(new StyleBundle("~/Content/themes/base/css").Include(
            //            "~/Content/themes/base/jquery.ui.core.css",
            //            "~/Content/themes/base/jquery.ui.resizable.css",
            //            "~/Content/themes/base/jquery.ui.selectable.css",
            //            "~/Content/themes/base/jquery.ui.accordion.css",
            //            "~/Content/themes/base/jquery.ui.autocomplete.css",
            //            "~/Content/themes/base/jquery.ui.button.css",
            //            "~/Content/themes/base/jquery.ui.dialog.css",
            //            "~/Content/themes/base/jquery.ui.slider.css",
            //            "~/Content/themes/base/jquery.ui.tabs.css",
            //            "~/Content/themes/base/jquery.ui.datepicker.css",
            //            "~/Content/themes/base/jquery.ui.progressbar.css",
            //            "~/Content/themes/base/jquery.ui.theme.css"));
            #endregion

            bundles.Clear();
            bundles.IgnoreList.Clear();

            bundles.Add(new ScriptBundle("~/bundles/adminScript").Include(
                        "~/Scripts/jquery/jquery-1.10.2.min.js",
                        "~/Scripts/jquery/jquery-ui-1.10.3.min.js",
                        "~/Scripts/jquery/jquery.form.min.js",
                        "~/Scripts/jquery/jquery.tmpl.min.js",
                        "~/Scripts/jquery/jquery.farbtastic.js",
                        "~/Scripts/circle.mvc.extension/circle.mvc.extension.min.js"
                        ));

            var preLibraryScriptBundle = new ScriptBundle("~/bundles/pre-libraryScript").Include(
                           "~/Scripts/library/jquery/jquery-1.7.2.min.js",
                           "~/Scripts/library/amplify/amplify.min.js",
                //moment.js
                           "~/Scripts/library/moment/moment.min.js",
                           "~/Scripts/library/moment/lang/zh-cn.js",
                           //"~/Scripts/library/moment/moment-with-langs.min.js",

                           //knockout
                           "~/Scripts/library/knockout/knockout-3.0.0.js",
                           //circle
                           "~/Scripts/circle/circle.js"
                            //"~/Scripts/library/knockout/knockout-2.3.0.js",
                );

            bundles.Add(preLibraryScriptBundle);

            var postLibraryScriptBundle = new ScriptBundle("~/bundles/post-libraryScript").Include(
                           "~/Scripts/library/json/json2.min.js",   
                //"~/Scripts/underscore/underscore-min.js",
                //"~/Scripts/library/jquery/jquery-ui-1.10.3.min.js",
                //pagination
                           "~/Scripts/library/jquery/jquery.simplePagination.js",
                //noty
                           "~/Scripts/library/noty/jquery.noty.js",
                           "~/Scripts/library/noty/layouts/top.js",
                           "~/Scripts/library/noty/layouts/center.js",
                           "~/Scripts/library/noty/layouts/bottom.js",
                           "~/Scripts/library/noty/themes/default.js",
                //bootstrap
                           "~/Scripts/library/bootstrap/bootstrap-v2.3.2.js",
                //"~/Scripts/library/bootstrap/bootstrap-v3.0.3.js",
             
                           "~/Scripts/library/knockout/knockout.mapping.js",
                           "~/Scripts/library/knockout/knockout.validation.min.js",
                           "~/Scripts/library/knockout/ko.editables.js",
                //jsclass
                //"~/Scripts/library/jsclass/loader-browser.js",
                //"~/Scripts/library/jsclass/core.js",
                //"~/Scripts/jsclass/enumerable.js",
                //"~/Scripts/jsclass/comparable.js",
                //"~/Scripts/jsclass/hash.js",
                
               
                           //circle
                           "~/Scripts/circle/circle.extend.js",
                           "~/Scripts/circle/circle.utility.js",
                           
                           //lang
                            "~/Scripts/circle/lang/"+WebCircleConfig.DefaultSetting.Language.Culture+ ".js",
                           
                           "~/Scripts/circle/model/model.js",
                           "~/Scripts/circle/model/model.user.js",
                           "~/Scripts/circle/model/model.content.js",


                           "~/Scripts/circle/site/site.js",
                           "~/Scripts/circle/site/site.user.js",
                           "~/Scripts/circle/site/site.layout.js",  // site.layout.js required circle.viewModel.tokenUser.js
                           "~/Scripts/circle/site/site.content.js"
                        );
            postLibraryScriptBundle.Include("~/Scripts/library/kindeditor/kindeditor.js");
            postLibraryScriptBundle.Include("~/Scripts/library/lang/zh_CN.js");
            //switch (WebCircleConfig.DefaultSetting.Language.Culture.ToLower())
            //{ 
            //    case "en-us":
            //        //postLibraryScriptBundle.Include("~/Scripts/library/xheditor/xheditor-1.1.14-en.min.js");
            //        break;
            //    case "zh-cn":
            //        postLibraryScriptBundle.Include("~/Scripts/library/xheditor/xheditor-1.1.14-zh-cn.min.js");
            //        break;
            //    case "zh-tw":
            //        postLibraryScriptBundle.Include("~/Scripts/library/xheditor/xheditor-1.1.14-zh-tw.min.js");
            //        break;
            //    default:
            //        postLibraryScriptBundle.Include("~/Scripts/library/xheditor/xheditor-1.1.14-en.min.js");
            //        break;
            //}
            
            bundles.Add(postLibraryScriptBundle);



            //Css
            var skinDirectory = string.Format("~/Themes/{0}/skin/{1}", WebCircleConfig.DefaultSetting.Theme, WebCircleConfig.DefaultSetting.Skin);

            bundles.Add(new StyleBundle("~/Content/adminSiteCss")
                                        .Include("~/Content/site.css")
                                        .Include("~/Content/admin.site.css")
                                        .Include("~/Content/circle.extension/circle.ui.css")
                                        .IncludeDirectory(skinDirectory, "*.css"));

            bundles.Add(new StyleBundle("~/Content/siteCss")
                                        .Include("~/Content/bootstrap/css/bootstrap-v2.3.2.css")
                                        .Include("~/Content/library/simplePagination.css")
                //.Include("~/Content/bootstrap/css/bootstrap-v3.0.3.css")
                                        .Include("~/Content/site.css")
                                        .Include("~/Content/user.site.css"));
            //.IncludeDirectory(skinDirectory, "*.css"));

        }
    }
}